home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group98c.txt
/
000032_icon-group-sender _Wed Sep 16 08:38:15 1998.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
4KB
Return-Path: <icon-group-sender>
Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) with SMTP id IAA21918
for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Wed, 16 Sep 1998 08:38:12 -0700 (MST)
Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
id AA03742; Wed, 16 Sep 1998 08:37:43 -0700
Message-Id: <35FF1A94.66F1@gte.net>
Date: Tue, 15 Sep 1998 20:55:32 -0500
From: MJE <evans@gte.net>
Reply-To: evans@gte.net
Organization: None
X-Mailer: Mozilla 3.01 (Win95; I)
Mime-Version: 1.0
To: icon-group@optima.CS.Arizona.EDU
Subject: Re: Context Switching
References: <199809152057.NAA09001@varda.premenos.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Transfer-Encoding: 7bit
Content-Transfer-Encoding: 7bit
Errors-To: icon-group-errors@optima.CS.Arizona.EDU
Content-Transfer-Encoding: 7bit
Status: RO
If you want a language that can do a lot more than C, then why rely all
the time on C conventions, instead of making your own?
Icon is wonderful with strings because the strings are not C strings,
they are Icon objects. Analogy: Icon can be wonderful with stacks,
because the stacks are not C stacks, but Icon stacks.
Icon has complete control of how it handles functions, coexpressions,
recursion, and so on, there is no mandatory requirement that they all be
treated as C function calls. Icon doesn't have to put parameters on a
stack, it can put them on the heap and "context-switch" by switching
data pointers to blocks on the heap. You could implement several
"stack" structures right on the heap, instead of relying on the system
stack.
Those heap-based stacks would handle all the issues involved in
context-switching, without resorting to fancy thread systems.
Built-in operators and functions can easily be rewritten to assume that
their stack exists elsewhere. I.e., as C calls, they take no input
parameters, but instead lookup a global pointer that gives them their
current stack somewhere on the heap, then they take parameters from
that.
Or, rather than rewriting the builtins, you just wrap them with
"handlers" that know about these things and put the right parameters
into the standard C function calls. So, none of the built-ins change,
but you add "handlers" to baby-sit them with respect to the switching
stacks.
The idea of "fooling" the Icon executable, and doing so in a way that is
non-portable, assembler-based, and buggy, and that will break with every
vendor's compiler release, is what I dislike.
I just wanted to share these ideas. Maybe I haven't really knocked down
your points, but that's OK, we share ideas here.
Mark
Ken Walker wrote:
>
> > From evans@gte.net Tue Sep 15 12:45:59 1998
> >
> > Thanks, but I think you missed my point. The hidden assumption here is
> > that Icon function calls shall behave exactly like C function calls. I
> > am trying to say that, with auxiliary data structures, the job might be
> > done without threads.
>
> That is a good point. On the other hand the Icon runtime system is
> currently written in C and makes use of the C stack. There can be
> "suspended" C frames on stack when a context switch occurs. The changes
> needed to perform a co-expression context switch without doing a C-level
> context switch would be significant in the interpreter and some of
> the runtime system might end up looking rather ugly. It would be
> even more work in the compiler; the compiler converts Icon code into
> C code. Would such a change be worth making it a little easier to
> port co-expressions?
>
> Ken Walker, kenneth.walker@sfo.harbinger.com
> Harbinger Coporation, Concord, Ca. 94520
Clinton Jeffery wrote:
>
> Mark,
>
> > I think you missed my point. The hidden assumption here is that Icon
> > function calls shall behave exactly like C function calls. I am trying to
> > say that, with auxiliary data structures, the job might be done without
> > threads.
>
> Co-expressions include the state of suspended built-in operators and
> functions, which *are* implemented by C functions. If generators and
> "suspend" were only allowed from Icon source code to Icon source code,
> then I think you would be right about this, but since they include
> suspended C functions, I am afraid we have to swap the C stack.
>
> Clint